#include <cstdio>
#include <cstring>

const int Module = 1000111;

char s1[ 100001 ], s2[ 100001 ];
int l1, l2;

int main( )
{
    int i, j, hash1, hash2, t, p1, p2;
    while ( gets( s1 ) )
    {
        gets( s2 );
        l1 = strlen( s1 );
        l2 = strlen( s2 );
        if ( l1 < l2 )
        {
            puts("no");
            continue;
        }
        hash1 = hash2 = 0;
        t = 1;
        for ( i = 0; i < l2 - 1; i++ )
            t = ( t * 7 ) % Module;
        for ( i = 0; i < l2; i++ )
        {
            hash2 = ( hash2 * 7 + s2[ i ] ) % Module;
            hash1 = ( hash1 * 7 + s1[ i ] ) % Module;
        }
        if ( hash1 == hash2 )
        {
            puts("yes");
            continue;
        }
        for ( i = l2; i < l1 * 2; i++ )
        {
            p1 = ( i - l2 ) % l1;
            p2 = i % l1;
            if ( hash1 < ( s1[ p1 ] * t ) % Module )
                hash1 += Module;
            hash1 = ( ( hash1 - ( s1[ p1 ] * t ) % Module ) * 7 + s1[ p2 ] ) % Module;
            if ( hash1 == hash2 )
                break;
        }
        if ( hash1 == hash2 )
            puts("yes");
        else
            puts("no");
    }
    return 0;
}
